//
//  FindAddActivityCtr.m
//  Four_years
//
//  Created by lx on 15/11/12.
//  Copyright © 2015年 中软三班四年小组. All rights reserved.
//

#import "FindAddActivityCtr.h"

@interface FindAddActivityCtr ()
@property UITableView * tableView;
@property UIView * headView;
@end

@implementation FindAddActivityCtr

- (id)init{
    if (self = [super init]) {
        self.title = @"发起活动";
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self initNavigation];
    _tableView = [[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStyleGrouped];
    _tableView.dataSource = self;
    _tableView.delegate = self;
    [self.view addSubview:_tableView];
    [self initHeadView];
}

- (void)initHeadView{
    _headView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 150)];
    //图片和名称
    UIView * view = [[UIView alloc]initWithFrame:CGRectMake(0, 10, WIDTH, 130)];
    view.backgroundColor = [UIColor whiteColor];
    [_headView addSubview:view];
    //图片
    UIImageView * imageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 20, 90, 90)];
    imageView.image = [UIImage imageNamed:@"xialalan1@2x"];
    [view addSubview:imageView];
    //名称
    UITextField * textField = [[UITextField alloc]initWithFrame:CGRectMake(115, 25, 150, 30)];
    textField.borderStyle = UITextBorderStyleRoundedRect;
    [view addSubview:textField];
    
    
    _headView.backgroundColor = [UIColor colorWithRed:235/255.0 green:235/255.0 blue:241/255.0 alpha:1];
    _tableView.tableHeaderView = _headView;
}

- (void)initNavigation{
    UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 40, 35)];
    label.userInteractionEnabled = YES;
    label.text = @"发布";
    label.textColor = [UIColor whiteColor];
    UIBarButtonItem * item = [[UIBarButtonItem alloc]initWithCustomView:label];
    self.navigationItem.rightBarButtonItem = item;
    UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(popSup:)];
    [label addGestureRecognizer:tap];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]init];
        
    }
    return cell;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

//储存数据并返回
- (void)popSup:(UITapGestureRecognizer *)tap{
    
    [self.navigationController popViewControllerAnimated:YES];
                       
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
}

@end
